<template>
	<view class="all_body">
		<view class="friend_main" v-for="item in requestUserInfo" :key="item.friendTokenTime">
			<view class="friendInfo">
				<view><image src="../../static/image/cat.jpeg"></view>
				<view class="">
					{{item.username}}({{item.mymail}})
				</view>
				<view class="iconfont icon-fanhui1"></view>
			</view>
			<view class="item_info">
				<view class="title">附加信息</view>
				<view class="title_detail">请求添加为好友</view>
			</view>
			
			<view class='item_info'>
				<view  class="title">来源</view>
				<view class="title_detail">精确查找</view>
			</view>
			
			
			<view class="item_foot" @click="acceptFriend()">
				<button type="primary">接受添加</button>
			</view>
			
			
			
			
		</view>
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	</view>
</template>

<script>
	export default {
		data(){
			return {
				requestUserInfo:[]
			}
		},
		methods:{
			acceptFriend(){
				let parmas = {
					friendTokenTime:this.requestUserInfo[0].friendTokenTime,//仅仅只能处理第一个
					isRead:true
				}
			  uni.request({
			  	url:"http://localhost:4008/babydataShow/update",
				method:"GET",
				data:parmas,
				success(res) {
					console.log(res)
					uni.navigateBack({
						delta:1
					})
				}
			  })
			}
		},
		onLoad(e) {
			let that = this
			let infodata = JSON.parse(e.data)
			console.log(infodata)
			that.requestUserInfo = infodata
			
		}
		
		
		
		
		
		
	}
</script>

<style lang="less">
	.all_body{
		background: #c8c7cc40;
		font-family: "楷体";
	}
	.friend_main{
		width: 100vw;
		height: 50vh;
		padding-top: 50rpx;
		box-sizing: border-box;
		.friendInfo{
			width: 100%;
			height: 120rpx;
		   display: flex;
		   background: #fff;
		   justify-content: space-around;
		   align-items: center;
		   text-align: left;
		   border-bottom: 1rpx solid #ccc;
		   image{
			   width: 100rpx;
			   height: 100rpx;
			   border-radius: 100%;
			   margin:20rpx 40rpx 20rpx 40rpx;
		   }
		}
		.item_info{
			width: 100%;
			height: 120rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			background: #fff;
			border-bottom: 1rpx solid #ccc;
			text-align: left;
			.title{
				flex: 1;
				   margin:20rpx 40rpx 20rpx 60rpx;
			}
			.title_detail{
				flex: 3;
				  margin:20rpx 40rpx 20rpx 60rpx;
			}
		}
		
		.item_foot{
			margin-top: 50rpx;
			button{
				width: 90%;
				height: 100rpx;
				border-radius: 20rpx;
				color: #fff;
			}
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
</style>
